<?php session_start(); ?>
<?php
 if(!$_SESSION['uname']){
  echo "你没有权限访问此页面!";
  return false;
}
?>
<?php include("../inc/db_config.inc"); ?>
<?php
if(isset($_REQUEST['cid'])&&$_REQUEST['cid']!=""){
    $cata_cid=$_REQUEST['cid'];
}else{
    echo "分类ID不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['title'])&&$_REQUEST['title']!=""){
	$title=$_REQUEST['title'];
    $cata_title=trim($title);
}else{
    echo "标题不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}

if(isset($_REQUEST['desc'])&&$_REQUEST['desc']!=""){
	
    //$post_content=$content;
    if (get_magic_quotes_gpc()) {
			$cata_desc = addslashes($_REQUEST['desc']);
			
		} else {
			$cata_desc = $_REQUEST['desc'];
		}
}else{
    echo "简介不能为空<a href='javascript:history.back()'>返回</a>";
    return false;
}
if(isset($_REQUEST['status'])&&$_REQUEST['status']!=""){
    $cata_status=$_REQUEST['status'];
}else{
    $cata_status=0;
}

date_default_timezone_set("Asia/Shanghai"); //北京时间
$post_created=date("Y-m-d H:i:s");
$post_pubid=1;

$result_post=mysql_query("update blog_cata set name='$cata_title',cataDesc='$cata_desc',status='$cata_status' where id=$cata_cid");
if(mysql_affected_rows()>0){
    //$getID=mysql_insert_id();
    $ref=$_SERVER['HTTP_REFERER'];
    echo "更新成功!页面会在1秒钟后自动返回.<script type='text/javascript'>setTimeout(function(){window.location.href='$ref'},1000)</script>";
}else{
    echo "更新失败!<a href='javascript:history.back()'>返回</a>";
    echo mysql_error();
}
 ?>